/*
 * Copyright 2010 Electronic Business Systems Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package gr.ebs.gssdroid.util;



import gr.ebs.gssdroid.resource.FileResource;
import gr.ebs.gssdroid.resource.FolderResource;
import gr.ebs.gssdroid.resource.GroupUserResource;

import java.io.Serializable;
import java.util.List;


/**
 * @author kman
 *
 */
public class ClipboardItem implements Serializable{
	private int operation;
	private FileResource file;
	private List<FileResource> files;
	private FolderResource folderResource;
	private GroupUserResource user;

	public ClipboardItem(){}

	public ClipboardItem(int anOperation, List<FileResource> theFiles){
		operation = anOperation;
		files = theFiles;
	}

	public ClipboardItem(int anOperation, FileResource aFile){
		operation = anOperation;
		file = aFile;
	}

	public ClipboardItem(int anOperation, FolderResource folder){
		operation = anOperation;
		folderResource = folder;
	}
	public ClipboardItem(int anOperation, GroupUserResource aUser){
		operation = anOperation;
		user = aUser;
	}

	public ClipboardItem(GroupUserResource aUser){
		operation = Clipboard.COPY;
		user = aUser;
	}

	public ClipboardItem(List<FileResource> theFiles){
		operation = Clipboard.COPY;
		files = theFiles;
	}

	public ClipboardItem(FileResource aFile){
		operation = Clipboard.COPY;
		file = aFile;
	}

	public ClipboardItem(FolderResource folder){
		operation = Clipboard.COPY;
		folderResource = folder;
	}

	/**
	 * Retrieve the user.
	 *
	 * @return the user
	 */
	public GroupUserResource getUser() {
		return user;
	}

	/**
	 * Modify the user.
	 *
	 * @param aUser the user to set
	 */
	public void setUser(GroupUserResource aUser) {
		user = aUser;
	}

	/**
	 * Retrieve the operation.
	 *
	 * @return the operation
	 */
	public int getOperation() {
		return operation;
	}

	/**
	 * Modify the operation.
	 *
	 * @param anOperation the operation to set
	 */
	public void setOperation(int anOperation) {
		operation = anOperation;
	}

	/**
	 * Retrieve the file.
	 *
	 * @return the file
	 */
	public FileResource getFile() {
		return file;
	}

	/**
	 * Modify the file.
	 *
	 * @param aFile the file to set
	 */
	public void setFile(FileResource aFile) {
		file = aFile;
	}

	/**
	 * Retrieve the files.
	 *
	 * @return the files
	 */
	public List<FileResource> getFiles() {
		return files;
	}

	/**
	 * checks whether the clipboard item is a file or folder
	 */
	public boolean isFileOrFolder(){
		if(file !=null || files != null || folderResource != null)
			return true;
		return false;
	}

	/**
	 * checks whether the clipboard item is a file (or files)
	 */
	public boolean isFile() {
		if(file !=null || files != null)
			return true;
		return false;
	}

	public boolean isUser(){
		if( user!=null  )
			return true;
		return false;
	}

	/**
	 * Retrieve the folderResource.
	 *
	 * @return the folderResource
	 */
	public FolderResource getFolderResource() {
		return folderResource;
	}

	/**
	 * Modify the folderResource.
	 *
	 * @param aFolder the folderResource to set
	 */
	public void setFolderResource(FolderResource aFolder) {
		folderResource = aFolder;
	}
}
